/**
 * License under GNU's GPL 
 * Invoice.java 
 */
import java.util.Scanner;

/**
 * Class represents the invoice created
 * 
 * @author Team 9
 * @version 1.0
 * 
 */
public class Invoice {
	/**
	 * constant value 10.0
	 */
	private static final double TEN = 10.0;

	/**
	 * constant value 15.0
	 */
	private static final double FIFTEEN = 15.0;

	/**
	 * constant value 2
	 */
	private static final int TWO = 2;

	/**
	 * constant value 3
	 */
	private static final int THREE = 3;

	/**
	 * Overrides the toString() method to print the appropriate instance
	 * variables
	 * 
	 * @return String to be printed
	 */
	@Override
	public String toString() {
		return "invoice [cost=" + cost + ", tylenol=" + tylenol + ", cold="
				+ cold + ", other=" + other + "]";
	}

	/**
	 * Double to hold the cost
	 */
	private double cost;

	/**
	 * Double to hold the cost of tylenol
	 */
	public double tylenol;

	/**
	 * Double to hold the cost for cold medicine
	 */
	public double cold;

	/**
	 * Double to hold other costs
	 */
	public float other;

	/**
	 * Constructor for the class
	 */
	public Invoice() {
		tylenol = TEN;
		cold = FIFTEEN;
	}

	/**
	 * Method to generate an invoice and print it on the screen
	 * 
	 * @param perscriptions
	 *            value to specify the prescription
	 */
	public void generateInvoice(int perscriptions) {
		final int perscript = perscriptions;
		if (perscript == 1) {
			System.out.println("Cost: $" + tylenol);
			cost = tylenol;
		} else if (perscript == TWO) {
			System.out.println("Cost: $" + cold);
			cost = cold;
		} else if (perscript == THREE) {
			final Scanner scan = new Scanner(System.in);
			System.out.println("Enter medicine price:");
			final double next = scan.nextDouble();
			System.out.println("Cost: $" + next);
			cost = next;
		}
	}

	/**
	 * Setter for cost
	 * 
	 * @param cost
	 *            value for cost
	 */
	public void setCost(double cost) {
		this.cost = cost;
	}

	/**
	 * Getter for cost
	 * 
	 * @return cost
	 */
	public double getCost() {
		return cost;
	}
}
